<?php


namespace app\http\middleware;


use think\facade\Cache;
use think\facade\Request;

class requestTime
{
    public function handle($request, \Closure $next)
    {
        $ip = Request::ip();
        $agent = Request::header("user-agent");
        $str = md5($ip.$agent);
        if (Cache::has("ic_".$str)){
            return pxsFailedJson("请求频繁~");
        }
        Cache::set("ic_".$str,$str,1);
        return $next($request);
    }
}